package 力扣日常刷题.木23一月.第09天309;

/**
 * @author 帅小伙
 * @date 2022/3/9
 * @description
 */
public class Demo37圆圈中最后剩下的数字 {

    public int lastRemaining(int n,int m) {
        int ans = 0;
        for (int i = 2; i <= n; i++) {
            ans = (ans + m) % i;
        }
        return ans;
    }

}
